package Day09.Test;

import java.util.ArrayList;

public class DemoEmployee {
    public static void main(String[] args) {
        Employee s1 = new Employee("张三", 3000);
        Employee s2 = new Employee("李四", 3500);
        Employee s3 = new Employee("王五", 4000);
        Employee s4 = new Employee("赵六", 4500);
        Employee s5 = new Employee("田七", 5000);
        ArrayList<Employee> list = new ArrayList<>();
        list.add(s1);
        list.add(s2);
        list.add(s3);
        list.add(s4);
        list.add(s5);
        for (int i = 0; i < list.size(); i++) {
            Employee y = list.get(i);
            if (y.getName().equals("王五")) {
                y.setName("王小五");
            }
            if (y.getName().equals("赵六")) {
                list.remove(i);
                i--;
            }
            if (y.getName().equals("田七")) {
                y.setSalary(y.getSalary() + 500);
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.println(list.get(i).getName()+", "+list.get(i).getSalary());
        }

    }
}





